<template>
    <div class="pull-container">
        <PullRefresh v-model="isLoading" @refresh="onRefresh">
           <div class="pull-content">
                <p>刷新次数: {{ count }}</p>
           </div>
        </PullRefresh>
    </div>
</template>

<script>
import { defineComponent, ref } from 'vue'
import { PullRefresh } from 'vant'
export default defineComponent({
  components: {
    PullRefresh
  },
  setup () {
    const isLoading = ref(false)
    const count = ref(0)
    const onRefresh = () => {
      setTimeout(() => {
        count.value++
        isLoading.value = false
      }, 2000)
    }
    return {
      isLoading,
      count,
      onRefresh
    }
  }
})
</script>

<style lang="less" scoped>
    .pull-container {
        width: 100%;
        .pull-content {
            height: 100vh;
            p {
                text-align: center;
                padding: 20px 0px;
            }
        }
    }
</style>
